<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="css/iconfont.css" />
		<link rel="stylesheet" type="text/css" href="css/style.css" />
		<style type="text/css">
			.btn-trade {}
			
			.mui-content>.mui-table-view:first-child {
				margin-top: 0;
			}
			
			.mui-row>div {
				padding: 5px 0;
			}
			 
			.mui-grid-view.mui-grid-9 {
				border-width: 0;
			}
			.header{background: url(images/bg1.jpg) no-repeat center;background-size: cover;}
			.user {background: rgba(255,255,255,.7);padding: 15px 15px;}			
			.user-headimg {
				font-size: 70px;
				color: #ccc;
				margin-right: 10px;
			}
			
			.user-info {
				padding-top: 12px;
			}
			
			.mui-table-view .mui-table-view-cell span.user-qr {
				padding-top: 18px;
			}
			
			.user-qr .icon-qr {
				font-size: 24px;
				color: #999;
			}
			
			.mui-table-view-chevron .iconfont{
				font-size: 18px;
				vertical-align: middle;
				margin-right: 5px;
				color: #F14E11;
			}
			.mui-table-view-chevron .mui-table-view-cell{
				vertical-align: middle;
			}
			.mui-table-view-chevron .mui-table-view-cell a{
				vertical-align: middle;
			}
			.mui-table-view .mui-table-view-cell span.mui-pull-right{
				padding-top: 0;
			}
			.mui-grid-view.mui-grid-9 .mui-table-view-cell{border-width: 0;}
			.mui-grid-view.mui-grid-9 .mui-table-view-cell .iconfont{/*color: #F14E11 !important;*/}
			.icon-wallet{color: #80adff !important;}
			.icon-deposit1{color: #5ec1f7 !important;}
			.icon-commission{color: #ff8796 !important;}
			.icon-card{color: #ffb30d !important;}
			
		</style>
	</head>

	<body>
		<div class="mui-content">
			<ul class="mui-table-view mui-table-view-chevron header margin-bottom-no">
				<li class="mui-table-view-cell user">
					<a href="profile.html" class="mui-navigate-right" id="btnUserDetails">
						<span class="mui-icon mui-icon-contact mui-pull-left user-headimg"></span>
						<div class="mui-pull-left user-info">
							<h4 id="Nickname"></h4>
							<p id="Mobile"></p>
						</div>
						<span class="mui-pull-right user-qr">
							<!--<span class="mui-icon iconfont icon-qr"></span>-->
						</span>
					</a>
				</li>
			</ul>

			<ul id="menu" class="mui-table-view mui-grid-view mui-grid-9 mui-panel margin-top-no">
				<li class="mui-table-view-cell mui-media mui-col-xs-3">
					<a href="balance.html">
						<span class="mui-icon iconfont icon-wallet"></span>
						<div class="mui-media-body">钱包</div>
					</a>
				</li>
				<li class="mui-table-view-cell mui-media mui-col-xs-3">
					<a href="account-out.html" data-type="IDAuth">
						<span class="mui-icon iconfont icon-deposit1"></span>
						<div class="mui-media-body">保证金</div>
					</a>
				</li>
				<li class="mui-table-view-cell mui-media mui-col-xs-3">
					<a href="bill.html">
						<span class="mui-icon iconfont icon-commission"></span>
						<div class="mui-media-body">佣金</div>
					</a>
				</li>
				<li class="mui-table-view-cell mui-media mui-col-xs-3">
					<a href="bankcard.html" data-type="IDAuth">
						<span class="mui-icon iconfont icon-card"></span>
						<div class="mui-media-body">
							银行卡
						</div>
					</a>
				</li>
			</ul>
			<ul class="mui-table-view mui-table-view-chevron mui-panel">
				<li class="mui-table-view-cell">
					<a href="profile-authentication.html" class="mui-navigate-right">
						<span class="mui-icon iconfont icon-tuandui"></span> 我的团队
					</a>
				</li>
				<li class="mui-table-view-cell">
					<a href="profile-authentication.html" class="mui-navigate-right">
						<span class="mui-icon iconfont icon-identification"></span> 实名认证
						<span class="mui-pull-right" id="IsCertified">已认证<span class="mui-icon mui-icon-checkmarkempty" style="color: #2AC845;"></span></span>
					</a>
				</li>
				<li class="mui-table-view-cell">
					<a href="password-login.html" class="mui-navigate-right">
						<span class="mui-icon iconfont icon-mima"></span> 登录密码
					</a>
				</li>
				<li class="mui-table-view-cell">
					<a href="password-pay.html" class="mui-navigate-right">
						<span class="mui-icon iconfont icon-paypassword"></span> 支付密码
					</a>
				</li>
			</ul>
			<ul class="mui-table-view mui-table-view-chevron mui-panel">
				<li class="mui-table-view-cell">
					<a href="account-promotion.html" class="mui-navigate-right">
						<span class="mui-icon iconfont icon-share"></span> 推广赚钱
					</a>
				</li>
			</ul>
			<ul class="mui-table-view mui-table-view-chevron">
				<li class="mui-table-view-cell">
					<a href="javascript:void(0)" class="mui-navigate-right" id="btnVersion">
						<span class="mui-icon iconfont icon-versionupdating"></span> 版本更新
						<span class="mui-pull-right" id="Version"></span>
					</a>
				</li>
				<!--
                	作者：68475633@qq.com
                	时间：2016-08-13
                	描述：
                <li class="mui-table-view-cell">
					<a href="javascript:void(0)" class="mui-navigate-right" id="btnAbout">
					<span class="mui-icon mui-icon-info"></span>
					关于我们
					</a>
				</li>-->
			</ul>
			<ul class="mui-table-view">
				<li class="mui-table-view-cell" style="text-align: center;" id="btnExit">
					退出登录
				</li>
			</ul>
		</div>
		<script src="js/mui.min.js"></script>
		<script src="libs/jquery.min.js"></script>
		<script src="libs/Highstock-2.1.5/highstock.js"></script>
		<script src="js/app.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/resources.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/update.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			mui.init();		
			
			mui.plusReady(function () {
				plus.runtime.getProperty(plus.runtime.appid, function(inf) {
					document.getElementById("Version").innerHTML = inf.version;
					console.log("当前应用版本：" + inf.version);
				});
			})
			
			$id("btnVersion").addEventListener('tap', function(){
					mui.checkUpdate(function(key) {
	                    if (key){
	                        console.log("有新版本更新");
	                        mui.downWgt(true);
	                    }
	                    else{ 
	                    	console.log("无新版本可更新");
	                    	alert("当前已是最新版本");
	                    }
	                }, false);
				});
									
			mui(".mui-content").on("tap", "a", function() {
				var href = this.href;
				var id = this.getAttribute("data-id") || href.substr(href.lastIndexOf("/")+1);
				var titleType = this.getAttribute("data-type");
				console.log(id);
				if(href == "#" || href == "javascript:;" || href == "javascript:void(0)"){
					return false;
				}
				
				if(titleType == "webview"){
					mui.openWindowWithTitle({
						url:href,
						id:id,
//						styles:webview_style,
						show:{
							event:"loaded",
//							extras:extras
						}
					},{
						backgroundColor:"#ffffff",//导航栏背景色
						bottomBorderColor:"#eeeeee",//底部边线颜色
						title:{
							text:this.innerText.trim()
						},
						back:{
							image:{
								base64Data:""
							}
						}
					});
				}
				else{
					if(titleType == "IDAuth"){
						if(!app.checkIDAuth()){
							return false;
						}
					}
					mui.openWindow(href, id);
				}
				return false;
			});
			
			document.getElementById("btnExit").addEventListener('tap', function() {								
				mui.confirm("确定要退出当前登录吗？", "退出确定", function (e) {
					if(e.index == 1){
						app.post("Logout", {
								account: app.account()
							}, function() {
								console.log("logout");
						});
						app.logout();
					}
				});
			});

			init = function () {
				console.log("account init");
				app.refreshUser(function (data) {
					console.debug(JSON.stringify(data));
					var user = data.User;

					document.getElementById("Nickname").innerText = user.Nickname || (user.LastName + user.FirstName) || user.MobileNo;
					document.getElementById("Mobile").innerText = user.MobileNo;								
					setAuthenticationStatus(user.AuthenticationStatus);					
				});
			}
			
			setAuthenticationStatus = function (status) {
				document.getElementById("IsCertified").innerHTML = resources.GetCertifiedStatusText(status);				
			}
			
			setNickname = function (nickname) {
				document.getElementById("Nickname").innerText = nickname;
			}
			
			init();
		</script>
	</body>
</html>